package org.doubango.FrCall.Screens;

import java.util.ArrayList;
import java.util.HashMap;

import org.doubango.FrCall.R;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.Toast;

public class GroupFriendPage extends Activity {
	private ListView manageFriendList;
	private Button manageFriendDelete;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.group_friend_page);
		View view = LayoutInflater.from(GroupFriendPage.this).inflate(R.layout.group_friend_list_item, null);
		manageFriendList = (ListView) findViewById(R.id.group_friend_list);
		manageFriendDelete =  (Button) view.findViewById(R.id.delete);
		ArrayList<HashMap<String, String>> data = new ArrayList<HashMap<String,String>>();
		HashMap<String, String> map = new HashMap<String, String>();
		map.put("groupfriendname", "同学");
		data.add(map);
		data.add(map);
		data.add(map);
		data.add(map);
		data.add(map);
		data.add(map);
		data.add(map);
		data.add(map);
		SimpleAdapter adapter = new SimpleAdapter(GroupFriendPage.this, data, R.layout.group_name_list_item, new String[]{"groupfriendname"}, new int[]{R.id.show_group_name});
		manageFriendList.setAdapter(adapter);
		manageFriendDelete.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				Toast.makeText(GroupFriendPage.this, "123456", 1000).show();
				
			}
		});

	}
	public void deleteFriend(View v){
		Builder builder = new Builder(GroupFriendPage.this);
		AlertDialog dialog = builder.create();
		dialog.setMessage("确认删除分组？");
		dialog.setButton(DialogInterface.BUTTON_POSITIVE, "确认", new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int which) {
				
			}
		});
		dialog.setButton(DialogInterface.BUTTON_NEGATIVE, "取消", new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int which) {
				
			}
		});
		dialog.show();
	}
	
}
